<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div @click="jia">
            <!-- stop事件修饰符阻止冒泡 -->
            <button @click.stop="jian">-</button></div>
        <form action="">
            <!-- prevent事件修饰符阻止默认提交事件 -->
            <input type="submit" value="提交" @click.prevent="sub">
        </form>
        <form action="">
            <!-- 监听某个键盘的键 -->
            <input type="text" value="提交" @keyup.prevent="qq">
        </form>
        <!-- .once只能触发一次 -->
        <button @click.once="qin">添加</button>

    </div>
    <script src="../../node_modules/vue/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                sun: 0
            },
            methods: {
                jia() {
                    console.log(123);
                },
                jian() {
                    console.log(456);
                },
                sub() {
                    console.log(789);
                },
                qq() {
                    console.log(45);
                },
                qin() {
                    console.log(11);
                }
            },
            computed: {

            }
        })
    </script>
</body>

</html>